﻿using System;
using System.Diagnostics;

namespace Transformable_Engine_v2.Engine.Time
{
    public class FrameTimer
    {
        private Stopwatch _timer;
        public TimeSpan ElapsedGameTime { get; private set; }
        public TimeSpan TotalGameTime { get; private set; }

        public FrameTimer()
        {
            _timer = new Stopwatch();

            ElapsedGameTime = new TimeSpan(0);
            TotalGameTime = new TimeSpan(0);
        }

        public void Start()
        {
            _timer.Start();
        }


        public void Update()
        {
            _timer.Stop();
            ElapsedGameTime = _timer.Elapsed;
            TotalGameTime += ElapsedGameTime;

            _timer.Reset();
            Start();
        }
    }
}